/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface BasCusKpinfo extends BasicModel<BasCusKpinfo> {
  cusCode?: string; // 客户
  ctype?: string; // 抬头类型
  cname?: string; // 名称
  contactInfo?: string; // 联系方式
  dutyNo?: string; // 税号
  bankName?: string; // 开户银行
  bankCode?: string; // 银行帐号
  dwNo?: string; // 单位号码
  dwAddr?: string; // 单位地址
  bdef?: string; // 是否默认
}

export const basCusKpinfoList = (params?: BasCusKpinfo | any) =>
  defHttp.get<BasCusKpinfo>({ url: adminPath + '/bas/cus/basCusKpinfo/list', params });

export const basCusKpinfoListData = (params?: BasCusKpinfo | any) =>
  defHttp.post<Page<BasCusKpinfo>>({ url: adminPath + '/bas/cus/basCusKpinfo/listData', params });

export const basCusKpinfoForm = (params?: BasCusKpinfo | any) =>
  defHttp.get<BasCusKpinfo>({ url: adminPath + '/bas/cus/basCusKpinfo/form', params });

export const basCusKpinfoSave = (params?: any, data?: BasCusKpinfo | any) =>
  defHttp.postJson<BasCusKpinfo>({ url: adminPath + '/bas/cus/basCusKpinfo/save', params, data });

export const basCusKpinfoImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/cus/basCusKpinfo/importData',
      onUploadProgress,
    },
    params,
  );

export const basCusKpinfoDelete = (params?: BasCusKpinfo | any) =>
  defHttp.get<BasCusKpinfo>({ url: adminPath + '/bas/cus/basCusKpinfo/delete', params });

export const basUserCusTree = (params?: BasCusKpinfo | any) =>
  defHttp.post<BasCusKpinfo>({ url: adminPath + '/bas/cus/treeData', params });